package tiruvury.InterviewPrep.SortAndSearchTests;

import tiruvury.InterviewPrep.SortAndSearch.SortAndSearch;

public class SortAndSearchTests
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		int[] arr =
		{ 3, -1, 8, -10, 0, 2, 1, 1, 2, -3, 4, 8, 2, -8, -8, -7, 5, -3, 0 };
		// int[] arr =
		// { 0, -1 };
		int[] sortedArr = null;

		int x = 7 / 2;
		System.out.println(x);

		PrintArr("Array before sorting", arr);
		sortedArr = SortAndSearch.BubbleSort(arr.clone());
		PrintArr("Array after BubbleSort   ", sortedArr);

		PrintArr("Array before SelectionSort", arr);
		sortedArr = SortAndSearch.SelectionSort(arr.clone());
		PrintArr("Array after SelectionSort", sortedArr);

		int[] a =
		{ 4, 5, 9, 11, 15, 29, 37, 45, 68, 91 };
		int[] b =
		{ 20, 30, 40, 50 };
		PrintArr("Array A: ", a);
		PrintArr("Array B: ", b);
		int[] c = SortAndSearch.MergeBIntoA(a, b);
		PrintArr("Array B merged into A: ", c);
	}

	private static void PrintArr(String msg, int[] arr)
	{
		System.out.print(msg);
		System.out.print(": { ");
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + ", ");
		}
		System.out.println(" }");
	}
}
